package ec.edu.cec.java.adv.archivos;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class CreateTmpFile {

	public static void main(String[] args) throws IOException {
		String cadena = "cadena ingresada por teclado";
		File dir = new File("c:/test/");
		File temp = File.createTempFile("fileTemporal", ".tmp", dir);
		//borra el archivo temporal
		temp.deleteOnExit();
		
		BufferedWriter out = new BufferedWriter(new FileWriter(temp));
		out.write(cadena);
		
		System.out.println("Temporary file created!!");
		out.close();
	}

}
